import classNames from 'classnames';
import styles from './style.less';

export default ({ text, onClick, value, selected = false, closable = false, disabled = false }) => {

  return (
    <a
      onClick={onClick ? onClick.bind(this, value) : void 0}
      className={classNames(styles.tag, {
        [styles['tag-selected']]: selected,
        [styles['tag-disabled']]: disabled,
      })}
    >
      <div className={`${styles.tagSider} ${styles.container}`}>
        {closable ? (
          <img alt="删除" style={{ width: 12, height: 12 }} src={'/icon/close.png'} />
        ) : null}
      </div>
      <span>{text}</span>
      <div className={styles.tagSider} />
    </a>
  );
};
